#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

void solve()
{
    string s;
    cin >> s;
    string t = "codeforces";
    int ans = 0;
    for(int i = 0; i < s.size(); i++) {
        if(s[i] != t[i]) ans++;
    }
    cout << ans << endl;
}

int main()
{
    int t = 1;
    cin >> t;
    while (t--)
        solve();
    return 0;
}